﻿<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta charset="UTF-8"/>
    <title>考核规则</title>
    <link href="../../Scripts/easyUI/themes/default/easyui.css" rel="stylesheet" type="text/css" />
    <link href="../../Scripts/easyUI/themes/icon.css" rel="stylesheet" type="text/css" />
    <script src="../../Scripts/jquery-1.7.2.min.js" type="text/javascript"></script>
    <script src="../../Scripts/easyUI/jquery.easyui.min.js" type="text/javascript"></script>
    <script src="../../Scripts/QueryString.js" type="text/javascript"></script>
    <link href="../../../DataUser/Style/ccbpm.css" rel="stylesheet"  type="text/css" />

    <!-- 引用通用的js文件. -->
    <script type="text/javascript" src="../../Scripts/config.js"></script>
    <script type="text/javascript" src="../../Comm/Gener.js"></script>
    <script src="../../Scripts/EasyUIUtility.js" type="text/javascript"></script>
    <script type="text/javascript" language="javascript" >
        var nodeID = "";
        //页面启动函数.
        $(function () {

            $("#Msg").html("正在加载,请稍后......");

            //初始化groupID.
            nodeID = GetQueryString("FK_Node");

            var node = new Entity("BP.WF.Template.CC");
            node.NodeID = nodeID;
            node.Retrieve();
            console.log(node);
            //调用公共类库的方法:执行批量主表赋值
            GenerFullAllCtrlsVal(node);

            var FK_Flow = node.FK_Flow;

            var FK_MapData = "ND" + parseInt(FK_Flow) + "Rpt";

            var mapAttrs = new Entities("BP.Sys.MapAttrs", "FK_MapData", FK_MapData);
            
            //增加slect的节点值 
            GenerBindDDL("DDL_CCFormAttr", mapAttrs, "KeyOfEn", "Name", node.CCFormAttr);


        });

        function WinOldStationOpen() {
            var url = "../../Comm/RefFunc/Dot2Dot.htm?EnName=BP.WF.Template.CC&Dot2DotEnsName=BP.WF.Template.CCStations&AttrOfOneInMM=FK_Node&AttrOfMInMM=FK_Station&EnsOfM=BP.WF.Port.Stations&DefaultGroupAttrKey=FK_StationType&NodeID=" + nodeID + "&PKVal=" + nodeID + "&s=" + Math.random();
            OpenEasyUiDialogExt(url,'抄送岗位',800, 500, true);
        }
        function WinNewStationOpen() {
            var url ="../../Comm/RefFunc/BranchesAndLeaf.htm?EnName=BP.WF.Template.CC&Dot2DotEnsName=BP.WF.Template.CCStations&Dot2DotEnName=BP.WF.Template.CCStation&AttrOfOneInMM=FK_Node&AttrOfMInMM=FK_Station&EnsOfM=BP.WF.Port.Stations&DefaultGroupAttrKey=FK_StationType&NodeID="+nodeID+"&PKVal="+nodeID+"&s=" + Math.random();

            OpenEasyUiDialogExt(url,'抄送岗位',800, 500, true);
        }
        function WinDeptOpen() {

            var url="../../Comm/RefFunc/Branches.htm?EnName=BP.WF.Template.CC&Dot2DotEnsName=BP.WF.Template.CCDepts&Dot2DotEnName=BP.WF.Template.CCDept&AttrOfOneInMM=FK_Node&AttrOfMInMM=FK_Dept&EnsOfM=BP.Port.Depts&DefaultGroupAttrKey=&NodeID="+nodeID+"&PKVal="+nodeID+"&s="+ Math.random();
           

            OpenEasyUiDialogExt(url, "抄送部门", 800, 600, true);
        }

        function WinEmpOpen() {
            var url ="../../Comm/RefFunc/BranchesAndLeaf.htm?EnName=BP.WF.Template.CC&Dot2DotEnsName=BP.WF.Template.CCEmps&Dot2DotEnName=BP.WF.Template.CCEmp&AttrOfOneInMM=FK_Node&AttrOfMInMM=FK_Emp&EnsOfM=BP.Port.Emps&DefaultGroupAttrKey=FK_Dept&NodeID="+nodeID+"&PKVal="+nodeID+"&s=" + Math.random();
          

            OpenEasyUiDialogExt(url, '抄送人员', 800, 500, true);
        }
        function Save() {

            var nodeID = GetQueryString("FK_Node");
            var node = new Entity("BP.WF.Template.CC");
            node.SetPKVal( nodeID);
            node.Retrieve();

            node.CopyForm();

            node.CCWriteTo = $("#DDL_CCWriteTo").val();
            node.CCFormAttr = $("#DDL_CCFormAttr").val();
            node.NodeID = nodeID;
            node.Update();

            window.location.href = window.location.href;

        }
    </script>
</head>
<body>

<form id="cc">
 <table style="width: 80%;">
        <tr>
            <th colspan="2">
                基本设置
            </th>
        </tr>
        <tr>
            <td class="style1">
                抄送写入规则
            </td>
            <td>
                <select name="DDL_CCWriteTo" id="DDL_CCWriteTo">
	<option selected="selected" value="0">写入抄送列表</option>
	<option value="1">写入待办</option>
	<option value="2">写入待办与抄送列表</option>

</select>
            </td>
        </tr>
        <tr>
            <th colspan="2">
                自动抄送人范围
            </th>
        </tr>
         <tr>
            <td class="style1">
                <input id="CB_CCIsAttr" type="checkbox" name="CB_CCIsAttr" /><label for="CB_CCIsAttr">按表单字段抄送？</label>
            </td>
            <td>
                 请选择设置抄送人员字段：<select id="DDL_CCFormAttr" name="DDL_CCFormAttr"></select> 
            </td>
        </tr>

        <tr>
            <td class="style1">
                <input id="CB_CCIsStations" type="checkbox" name="CB_CCIsStations" /><label for="CB_CCIsStations">抄送到岗位</label>
            </td>
            <td>
                <a href="javascript:WinOldStationOpen()">
                    请选择岗位(旧)</a>
                <a href="javascript:WinNewStationOpen()">
                    请选择岗位(新)</a>
                    岗位计算规则:<select name="DDL_CCStaWay" id="DDL_CCStaWay">
	                <option selected="selected" value="0">仅按岗位计算</option>
	                <option value="1">按岗位智能计算(当前节点)</option>
	                <option value="2">按岗位智能计算(发送到节点)</option>
	                <option value="3">按岗位与部门的交集</option>
	                <option value="4">按直线上级部门找岗位下的人员(当前节点)</option>
	                <option value="5">按直线上级部门找岗位下的人员(接受节点)</option>

</select>
            </td>
        </tr>
        <tr>
            <td class="style1">
                <input id="CB_CCIsDepts" type="checkbox" name="CB_CCIsDepts" /><label for="CB_CCIsDepts">抄送到部门</label>
            </td>
            <td>
                <a href="javascript:WinDeptOpen()">
                    请选择部门(0)</a>
            </td>
        </tr>
        <tr>
            <td class="style1">
                <input id="CB_CCIsEmps" type="checkbox" name="CB_CCIsEmps" /><label for="CB_CCIsEmps">抄送到人员</label>
            </td>
            <td>
                <a href="javascript:WinEmpOpen()">
                请选择人员(0)</a>
            </td>
        </tr>
        <tr>
            <td class="style1">
                <input id="CB_CCIsSQLs" type="checkbox" name="CB_CCIsSQLs" /><label for="CB_CCIsSQLs">按照SQL设置范围</label>
            </td>
            <td>
                <textarea name="TB_CCSQL" id="TB_CCSQL" style="width:638px; height: 113px;">
</textarea>
                <br />
                <font color=gray>您设置了按照SQL抄送，请您设置一个SQL语句，返回No,Name两个列,SQL支持ccbpm表达式。
                <br>比如:SELECT No,Name FROM Port_Emp WHERE FK_Dept='@WebUser.FK_Dept'
                </font>
            </td>
        </tr>
    </table>

    <input type="button" name="Btn_Save" value="保存" id="Btn_Save" onclick="Save()" />

</form>

</body>
</html>
